﻿var ChooserDialog = function(view, detailPanel, detailsTemplate) {
    this.detailPanel = detailPanel;
    this.detailsTemplate = detailsTemplate;
    this.view = view;
};

ChooserDialog.prototype = {

showDetails: function() {
    try{
        var selNode = this.view.getSelectedNodes();
        var detailEl = this.detailPanel.body;
        if (selNode && selNode.length > 0) {
            selNode = selNode[0];
            var tname = selNode.id;
            var data = lookup[tname];
            selectedData = data;
            detailEl.hide();
            this.detailsTemplate.overwrite(detailEl, data);
            detailEl.slideIn('l', { stopFx: true, duration: .2 });
        } else {

            detailEl.update('');
        }
        }catch(e){
        }
    },

    show: function() {
        this.reset();
    },

    reset: function() {
        if (this.view.rendered) {
            //Ext.getCmp('filter').reset();
            this.view.getEl().dom.scrollTop = 0;
        }
        this.view.store.reload();
        //this.view.store.clearFilter();
        this.view.select(0);
    }
};